<template>
  <div id="app">
    <TitleNav
      :svgcolor="svgcolor"
      :isShow="backisshow"
      :bgcolor="titlebgcolor"
      :titlecolor="titlecolor"
      :titlename="titlename"
    />
    <div class="contentdiv outtitle">
      <van-tabbar v-show="navisshow" v-model="active" >
        <van-tabbar-item
          icon="home-o"
          name="baoxiao"
          router-link to="/">申报</van-tabbar-item>
        <van-tabbar-item
          icon="search"
          name="hesuan"
          router-link to="/hesuan">核算</van-tabbar-item>
        <van-tabbar-item icon="friends-o" name="yiyi" router-link to="/yiyi" dot>异议</van-tabbar-item>
      </van-tabbar>
      <router-view class="contentdiv"/>
    </div>
  </div>
</template>

<script>
import TitleNav from '@/components/TitleNav.vue';


export default {
  components: {
    TitleNav,
  },
  data() {
    return {
      navisshow: '',
      backisshow:'',
      active: 'baoxiao',
      svgcolor: '#fff',
      titlebgcolor: '#1989fa',
      titlecolor: '#fff',
      titlename: '',
    };
  },
  methods: {

  },
  watch: {
    $route(e) {
      this.titlename = e.meta.title;
      if(e.name === 'Baoxiao') {
        this.backisshow = false;
        this.navisshow = true;
        this.active = 'baoxiao';
      }else if(e.name === 'Hesuan') {
        this.backisshow = false;
        this.navisshow = true;
        this.active = 'hesuan'
      }else if(e.name === 'Yiyi') {
        this.backisshow = false;
        this.navisshow = true;
        this.active = 'yiyi'
      }else{
        this.backisshow = true;
        this.navisshow = false;
      }
    }
  }
};
</script>

<style lang="scss">
body {
  margin: 0;
}
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

#nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
</style>
